const app = getApp()
const util = require("../../utils/util.js")

Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {},
    hasUserInfo: false,
    menuList: [
      {name:"我的订单", iconfont:"icon-gongdan", toUrl: "/pages/userSpace/orderList/orderList"},
      {name:"我的收藏", iconfont:"icon-shoucang", toUrl: "/pages/userSpace/collect/collect"},
      {name:"我的足迹", iconfont:"icon-fanshe", toUrl: "/pages/userSpace/footPrint/footPrint"},
      {name:"地址管理", iconfont:"icon-changjingguanli", toUrl: "/pages/userSpace/addressList/addressList"},
      {name:"账号安全", iconfont:"icon-anquan", toUrl: ""},
      {name:"用户反馈", iconfont:"icon-icon_fabu", toUrl: ""},
      {name:"帮助中心", iconfont:"icon-icon_yiwenkongxin", toUrl: ""},
    ]
  },

  naviLinkTo: function(event) {
    let url = event.currentTarget.dataset.url;
    // console.log(event.currentTarget.dataset.url)
    wx.navigateTo({
      url: url
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
 
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    let token = wx.getStorageSync('token');
    let userInfo = wx. getStorageSync('userInfo')

    if(!!token){
      this.setData({
        userInfo: userInfo,
        hasUserInfo: false
      })
    } else {
      wx.navigateTo({
        url: "/pages/login/login"
      })
    }
  },

  handleContact (e) {
    console.log(e.path)
    console.log(e.query)
}

})